﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Devart.Data.Universal;

namespace OnOne.Data
{
  public enum eProviders
  {
    pSQLServer,
    pOracle,
    pDB2,
    pMysql,
    pPostgreSQL,
    pSQLite,
    pFirebird,
    pADONet
  }

  public struct TConection
  {
    public eProviders _eProviders;
    public String sServer;
    public String sDataBase;
    public String sUserID;
    public String sPasswd;
    public int iPort;
    public int iTimout;

    public void SetConection(ref UniConnection conection)
    {
      switch (_eProviders)
      {
        case eProviders.pSQLServer:
          conection.Provider = "SQL Server"; return;
        case eProviders.pOracle:
          conection.Provider = "Oracle"; return;
        case eProviders.pDB2:
          conection.Provider = "DB2"; return;
        case eProviders.pMysql:
          conection.Provider = "MySQL"; return;
        case eProviders.pPostgreSQL:
          conection.Provider = "PostgreSQL";break;
        case eProviders.pSQLite:
          conection.Provider = ""; return;
        case eProviders.pFirebird:
          conection.Provider = "FirebirdClient"; break;
        case eProviders.pADONet:
          conection.Provider= ""; return;
      }
      conection.DataSource = sServer;
      conection.Database = sDataBase;
      conection.UserId = sUserID;
      conection.Password = sPasswd;
      conection.Port = iPort;
    }
  }
}
